package com.yueke.gemini.modules.springSession;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import com.yueke.gemini.aspect.annotation.RedisRateLimit;
import javax.servlet.http.HttpServletRequest;
import java.util.HashMap;
import java.util.Map;

/**
 * @author qinxuewu
 * @version 1.00
 * @time 8/8/2018下午 12:53
 */
@RestController
@RequestMapping(value = "/session")
public class TestController {
	 
	 
	@RedisRateLimit(key = "testLimt", time = 10, count = 10)  // 10 秒中内科可访问10次，可以访问10次
    @RequestMapping(value = "/test", method = RequestMethod.GET)
    public Map<String, Object> firstResp (HttpServletRequest request){
        Map<String, Object> map = new HashMap<>();
        request.getSession().setAttribute("request Url", request.getRequestURL());
        map.put("request Url", request.getRequestURL());
        return map;
    }

}
